package io.renren.modules.bs.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.bs.entity.BsExtractRecordDetailEntity;
import io.renren.modules.bs.vo.ExtractRecordDetailVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-08-15 23:03:14
 */
@Mapper
public interface BsExtractRecordDetailDao extends BaseMapper<BsExtractRecordDetailEntity> {

    @Select("SELECT erd.*,hosp.hospital_name,dept.department_name FROM bs_extract_record_detail erd \n" +
            "LEFT JOIN bs_hospital hosp on erd.hospital_id = hosp.hospital_id\n" +
            "LEFT JOIN bs_department dept on erd.department_id = dept.department_id\n" +
            "WHERE erd.record_id = #{recordId}")
    List<ExtractRecordDetailVo> listByRecordId(@Param("recordId") Long recordId);
}
